Skip to content

feat(search): collapsed search #4115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Aug 15, 2025

Conversation

aramos-adobe
Copy link
Contributor

@aramos-adobe aramos-adobe commented Aug 6, 2025

Description

The search component allows for a minimized state where the search field is collapsed to an action button. When clicked the the search field is visible.

How and where has this been tested?

Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.

Validation steps

Include steps for the PR reviewer that explain how they should test your PR. Example test outline:

  1. Open the storybook for the search component:
  • Check true is collapsed state (@cdransf)
  • Click the action button to show the search field (@cdransf)

Regression testing

Validate:

  1. The documentation pages for at least two other components are still loading, including:
  • The pages render correctly, are accessible, and are responsive.
  1. If components have been modified, VRTs have been run on this branch:
  • VRTs have been run and looked at.
  • Any VRT changes have been accepted (by reviewer and/or PR author), or there are no changes.

Screenshots

States

Screenshot 2025-08-15 at 11 11 18 AM

Accessibility

Keyboard Navigation

  • Tab key to access the search button and press Enter to expand the search field

To-do list

  • I have read the contribution guidelines.
  • I have updated relevant storybook stories and templates.
  • I have tested these changes in Windows High Contrast mode.
  • If my change impacts other components, I have tested to make sure they don't break.
  • If my change impacts documentation, I have updated the documentation accordingly.
  • ✨ This pull request is ready to merge. ✨

Copy link

changeset-bot bot commented Aug 6, 2025

🦋 Changeset detected

Latest commit: 62498f8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@spectrum-css/search Major
@spectrum-css/bundle Patch
@spectrum-css/preview Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Aug 6, 2025

File metrics

Summary

Total size: 1.43 MB*

Package Size Minified Gzipped
search 13.12 KB 12.57 KB 2.08 KB

search

Filename Head Minified Gzipped Compared to base
index.css 13.12 KB 12.57 KB 2.08 KB 🔴 ⬆ 0.67 KB
metadata.json 7.56 KB - - 🔴 ⬆ 0.22 KB
* Size is the sum of all main files for packages in the library.
* An ASCII character in UTF-8 is 8 bits or 1 byte.

Copy link
Contributor

github-actions bot commented Aug 6, 2025

📚 Branch preview

PR #4115 has been deployed to Azure Blob Storage: https://spectrumcss.z13.web.core.windows.net/pr-4115/index.html.

@aramos-adobe aramos-adobe self-assigned this Aug 6, 2025
Copy link
Member

@cdransf cdransf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! ✨

Copy link
Collaborator

@marissahuysentruyt marissahuysentruyt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work on this. I feel like I still mainly have questions, so I left a few for you 😊

I might consider just updating the changeset heading to "Collapsed" instead of "Minimized." Just personal preference though.

Have you reached out to design to ask about some of the focus and keyboard focus behaviors? I found the collapsed usage section in Figma, and the "focus state" of this button is just...open? That feels odd to me for some reason. Like if I was tabbing along, does it make sense for me to tab to this action button, and then it just be a completely different component? Anyways, I think this is more along the lines that I would expect, where I'm tabbing along, and I have to trigger the rest of the search field to open. I may be wrong though. Is that worth bringing up with design?


/* Animation for collapsible search expansion */
&.is-collapsed {
transition: inline-size 0.3s cubic-bezier(0.4, 0, 0.2, 1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how would you feel about maybe using of any of the --spectrum-animation-duration-* tokens? Maybe we can use that here? Or was the 0.3 design directed? And just because I'm nosy, where did you find these timing curves?!

Should the cubic-beziers and even the transition-duration be set as custom props? Maybe it's not necessary, but we do use the same curve & durations twice 🤷‍♀️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just experimenting with animation curves here. I don't know what the intended animation should be

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh nice! I've been learning about each of the values of the cubic-bezier function, so I was just curious!

@aramos-adobe aramos-adobe changed the title feat(search): minimized search feat(search): collapsed search Aug 11, 2025
@aramos-adobe aramos-adobe added ready-for-review S2 Spectrum 2 size-5 L ~30-42hrs; lots of effort or complexity, most of a sprint needed to complete. labels Aug 14, 2025
customClasses: [
`${rootClass}-actionButton`,
isHovered && "is-hover",
isDisabled && "is-disabled",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only suggestion is to make sure we can't keyboard focus to this button when it's disabled!

Screenshot 2025-08-14 at 6 55 16 PM

I'm not sure if this is a property thing? It certainly looks like we're passing the disabled arg through correctly- I see it on the search AND on the action button, but maybe we need to revisit the disabled+keyboard focus styles.

Copy link
Collaborator

@marissahuysentruyt marissahuysentruyt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beautiful!

Not technically a blocker, but we should make sure to continue defining a custom prop to use in our styles for consistency and maintainability. Instead of using --spectrum-animation-duration-800 directly in the styles, we typically create a component-specific custom prop that is set to animation-duration-800. It would help in the long run if that spec needs to change, we'd only have to update it once in the custom props at the top of the file, instead of multiple times throughout the file.

Again, not technically a blocker, but I'm a sucker for consistency 🥴

@aramos-adobe aramos-adobe merged commit e467fe0 into spectrum-two Aug 15, 2025
13 checks passed
@aramos-adobe aramos-adobe deleted the aramos-adobe/css1158-mini-search-follow-up branch August 15, 2025 16:49
@github-actions github-actions bot mentioned this pull request Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-review S2 Spectrum 2 size-5 L ~30-42hrs; lots of effort or complexity, most of a sprint needed to complete.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants